/**
 *
 * 主要用于分享统计，浏览统计
 */
const api = require("@/static/js/api.js")

// "card": "名片",
// "activity":  "活动",
// "panorama":  "全景图",
// "product":  "楼盘资料",
// "note":  "导购笔记",
// "article":  "文章",
// "house_type":  "户型",
// "poster":  "海报",
// "periphery":  "周边配套",
// "album":  "相册",
// "home": "主页",
// "track": "轨迹"
// "news": "楼盘动态"   
// "promoteCode": "推广码"             
const routeList = {
	//==首页
	'pages/shop/tabBar/index': 'home',
	'pages/client/tabBar/index': 'home',

	'pages/client/pointsMall/task': 'task',

	//==活动
	'pages/shop/activity/activityLottery': 'activity',
	'pages/shop/activity/activityLike': 'activity',
	'pages/shop/activity/activityCoupon': 'activity',
	'pages/shop/activity/activityGroupBuy': 'activity',
	'pages/shop/activity/activitySignUp': 'activity',
	'pages/shop/activity/activityHaggle': 'activity',


	'pages/client/activity/activityLottery': 'activity',
	'pages/client/activity/activityLike': 'activity',
	'pages/client/activity/activityCoupon': 'activity',
	'pages/client/activity/activityGroupBuy': 'activity',
	'pages/client/activity/activitySignUp': 'activity',
	'pages/client/activity/activityHaggle': 'activity',
	"pages/client/activity/activityRedpacket": 'activity',
	"pages/common/activityHtml/index": 'activity',

	//==文章
	'pages/shop/article/index': 'article',
	'pages/shop/article/articleDetail': 'article',
	'pages/client/article/articleDetail': 'article',

	//==VR
	'pages/shop/web/webShare': 'panorama',
	'pages/client/web/webShare': 'panorama',
	'pages/shop/web/index': 'panorama',
	'pages/client/web/index': 'panorama',
	'pages/trtcRoom/videochat/index': 'panorama',
	//==名片
	'pages/shop/myCard/index': 'card',
	'pages/client/card/card': 'card',


	//==项目
	'pages/shop/material/project/traffic': 'periphery',
	'pages/shop/material/project/building': 'product',
	'pages/shop/material/project/unitTypeDetail': 'house_type',
	'pages/shop/material/project/buildingAlbumDetail': 'album',
	'pages/shop/material/project/buildingVideoDetail': 'video',
	'pages/shop/material/project/myNoteDetail': 'note',
	'pages/shop/material/project/sandbox': 'panorama',

	'pages/client/project/traffic': 'periphery',
	'pages/client/project/building': 'product',
	'pages/client/project/unitTypeDetail': 'house_type',
	'pages/client/project/buildingAlbumDetail': 'album',
	'pages/client/project/buildingVideoDetail': 'video',
	'pages/client/project/myNoteDetail': 'note',
	"pages/client/project/news": 'news',
	"pages/client/project/newsDetail": 'news',

	"pages/client/signIn/index": "visit_check",
	
	'pages/shop/note/index': 'note',
	'pages/client/note/detail': 'note',
	
	'pages/calculator/record/detail': 'calculator',
	'pages/calculator/result/index': 'calculator'
}

// 红包弹窗是否有映射
const redpacketPathMap = {
	'pages/client/web/index': 'panorama',
	'pages/client/project/buildingVideo': 'video',
	'pages/client/project/buildingVideoDetail': 'video',
}
// 红包弹窗活动路径
const redpacketRouteMap = {
	'pages/client/web/index': 'panorama',
	'pages/client/project/buildingVideo': 'video',
}

//===分享路径映射    
const sharePathMap = {
	//==首页
	'pages/shop/tabBar/index': 'pages/client/tabBar/index',
	//==活动
	'pages/shop/activity/activityLottery': 'pages/client/activity/activityLottery',
	'pages/shop/activity/activityLike': 'pages/client/activity/activityLike',
	'pages/shop/activity/activityCoupon': 'pages/client/activity/activityCoupon',
	'pages/shop/activity/activityGroupBuy': 'pages/client/activity/activityGroupBuy',
	'pages/shop/activity/activitySignUp': 'pages/client/activity/activitySignUp',
	'pages/shop/activity/activityHaggle': 'pages/client/activity/activityHaggle',


	//==文章
	'pages/shop/article/articleDetail': 'pages/client/article/articleDetail',
	//==VR
	'pages/shop/web/webShare': 'pages/client/web/index', //有分享参数，不会用到这部分
	'pages/shop/web/index': 'pages/client/web/index',
	'pages/client/web/webShare': 'pages/client/web/index',
	//==名片  
	'pages/shop/myCard/index': 'pages/client/card/card',
	//==项目
	'pages/shop/material/project/traffic': 'pages/client/project/traffic',
	'pages/shop/material/project/building': 'pages/client/project/building',
	'pages/shop/material/project/unitTypeDetail': 'pages/client/project/unitTypeDetail',
	'pages/shop/material/project/buildingAlbumDetail': 'pages/client/project/buildingAlbumDetail',
	'pages/shop/material/project/myNoteDetail': 'pages/client/project/myNoteDetail',
	'pages/shop/material/project/buildingVideoDetail': 'pages/client/project/buildingVideoDetail',
	'pages/client/activity/activityRedpacket': 'pages/client/tabBar/index',
	//沙盘分享
	'pages/shop/material/project/sandbox': 'pages/client/web/index',
}


const shareMenuList = {
	//==首页
	// 'pages/shop/tabBar/index': 					'home',
	'pages/client/tabBar/index': 'home',

	'pages/client/pointsMall/task': 'task',

	//==活动
	'pages/shop/activity/activityLottery': 'activity',
	'pages/shop/activity/activityLike': 'activity',
	'pages/shop/activity/activityCoupon': 'activity',
	'pages/shop/activity/activityGroupBuy': 'activity',
	'pages/shop/activity/activitySignUp': 'activity',
	'pages/shop/activity/activityHaggle': 'activity',

	'pages/client/activity/activityLottery': 'activity',
	'pages/client/activity/activityLike': 'activity',
	'pages/client/activity/activityCoupon': 'activity',
	'pages/client/activity/activityGroupBuy': 'activity',
	'pages/client/activity/activitySignUp': 'activity',
	'pages/client/activity/activityHaggle': 'activity',
	//红包活动
	"pages/client/activity/activityRedpacket": 'activity',
	"pages/common/activityHtml/index": 'activity',
	//==文章
	'pages/shop/article/articleDetail': 'article',
	'pages/client/article/articleDetail': 'article',

	//==VR
	'pages/shop/web/webShare': 'panorama',
	'pages/client/web/webShare': 'panorama',
	'pages/shop/web/index': 'panorama',
	'pages/client/web/index': 'panorama',

	//==名片                                   
	'pages/shop/myCard/index': 'card',
	'pages/client/card/card': 'card',

	//==项目
	'pages/shop/material/project/traffic': 'periphery',
	'pages/shop/material/project/building': 'product',
	'pages/shop/material/project/unitTypeDetail': 'house_type',
	'pages/shop/material/project/buildingAlbumDetail': 'album',
	'pages/shop/material/project/buildingVideoDetail': 'video',
	'pages/shop/material/project/myNoteDetail': 'note',
	'pages/shop/material/project/sandbox': 'panorama',

	'pages/client/project/traffic': 'periphery',
	'pages/client/project/building': 'product',
	'pages/client/project/unitTypeDetail': 'house_type',
	'pages/client/project/buildingAlbumDetail': 'album',
	'pages/client/project/buildingVideoDetail': 'video',
	'pages/client/project/myNoteDetail': 'note',
	"pages/client/project/news": 'news',
	"pages/client/project/newsDetail": 'news',

	"pages/home/projects": 'projects',
}
const utils = require("@/static/js/utils.js")
let redpacketTimerId = null;

import {
	mapState,
	mapMutations,
	mapActions
} from 'vuex';

export default {
	data() {
		return {

			contentIdMixins: '',
			parentLogIdMixins: '',
			currentLogIdMixins: '',
			sharePathMixins: '',
			shareTitleMixins: '', //===分享标题
			shareImageMixins: '', //===分享图片
			sharePathParamMixin: '',
			isSinglePageMixin: uni.getStorageSync('singlePage') || false,
			hasRedpacketActivityMixin: false,
			isShowRedPacketMixin: false,
			isShowIntroMixin: false,
			redPacketRuleIntroMixin: '',
			redpacketPathMapMixins: redpacketRouteMap,
			multiProjectShareText: '',
			multiProjectShareImage: '',
		}
	},
	computed: {
		...mapState({
			hasLogin: state => state.userInfo.hasLogin,
			isAuthPhone: state => state.userInfo.isAuthPhone,
			isAuthUserInfo: state => state.userInfo.isAuthUserInfo,
			isSeller: state => state.userInfo.isSeller,
			isReferrer: state => state.userInfo.isReferrer,
			isChannel: state => state.userInfo.isChannel,
			sellerObj: state => state.userInfo.sellerObj,
			buyerObj: state => state.userInfo.buyerObj,
			shopInfo: state => state.userInfo.shopInfo,
			buyerId: state => state.userInfo.buyerObj.id,
		}),
	},

	onShareTimeline(obj) {
		let that = this;
		var title = that.shareTitleMixins;
		var obj = {
			projectId: uni.getStorageSync("projectId"),
			logId: that.currentLogIdMixins,
			id: that.contentIdMixins,
		}
		var query = utils.KeyValueToUrl(obj)

		console.log('onShareTimeline:', query, title)
		that.userLogMixins(2)
		return {
			title: title,
			query: query,
			imageUrl: ""
		};
	},
	async onShareAppMessage(obj) {
		let that = this;
		if (this.getIsProjectMixins()) {

			return {
				title: this.multiProjectShareText,
				path: "",
				imageUrl: this.multiProjectShareImage
			};
		}

		if (obj.target && obj.target.dataset && obj.target.dataset.id) {
			that.contentIdMixins = obj.target.dataset.id;
		}
		//===获取分享logId
		var logId = await that.getShareLogIdMixins()

		var path = '/pages/home/home?projectId=' + uni.getStorageSync("projectId")
		var logIdPath = '&logId=' + logId
		var shareUri = "&sharePath="
		var uri = '';
		var title = that.shopInfo.shareInfo;
		var imageUrl = that.shopInfo.shareImage;

		//===设置分享title
		if (that.shareTitleMixins && that.shareTitleMixins.length) {
			title = that.shareTitleMixins
		}
		//===设置分享image
		if (that.shareImageMixins && that.shareImageMixins.length) {
			imageUrl = that.shareImageMixins
		}

		if (obj.target && obj.target.dataset && obj.target.dataset.title && obj.target.dataset.title.length > 0) {
			title = obj.target.dataset.title
		}

		if (obj.target && obj.target.dataset && obj.target.dataset.imageurl && obj.target.dataset.imageurl.length >
			0) {
			imageUrl = obj.target.dataset.imageurl
		}



		if (that.sharePathParamMixin && that.sharePathParamMixin.length > 0) {
			uri = that.sharePathParamMixin;
		} else if (obj.from == "button" && obj.target.dataset.sharepath) {
			uri = obj.target.dataset.sharepath;
		} else {
			let routes = getCurrentPages();
			let curRoute = routes[routes.length - 1].route
			if (sharePathMap[curRoute]) {
				uri = '/' + sharePathMap[curRoute] + '?id=' + that.contentIdMixins
			} else {
				uri = '/' + curRoute + '?id=' + that.contentIdMixins
			}
		}
		if (uri.indexOf('?') == -1) {
			uri += '?logId=' + logId
		} else {
			uri += '&logId=' + logId
		}

		shareUri += encodeURIComponent(uri)
		that.sharePathMixins = path + logIdPath + shareUri
		console.log('onShareAppMessage:', obj, that.sharePathMixins)

		return {
			title: title,
			path: that.sharePathMixins,
			imageUrl: imageUrl
		};

		// this.$stats.trackEvent('share',{uuId: memberId,memberId:memberId});
	},
	onLoad(options) {
		let that = this
		let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
		let curRoute = routes[routes.length - 1].route //获取当前页面路由
		console.log("login status:", this.hasLogin)

		if ((curRoute.indexOf('pages/home')<0)&&(curRoute.indexOf('uni_modules/uni-upgrade-center-app')<0)) {
			if (this.hasLogin == false) {
				//===分享朋友圈
				if (options.logId && options.logId.length > 0) {
					console.log("分享朋友圈：", options)
					if (options.projectId) {
						uni.setStorageSync("projectId", options.projectId);
					}

					var Obj = {
						projectId: options.projectId,
						logId: options.logId,
						sharePath: "",
					}

					let routes = getCurrentPages();
					let curRoute = routes[routes.length - 1].route
					var uri = "";
					if (sharePathMap[curRoute]) {
						uri = '/' + sharePathMap[curRoute] + '?id=' + options.id
					} else {
						uri = '/' + curRoute + '?id=' + options.id
					}
					uri += '&logId=' + options.logId
					Obj.sharePath = encodeURIComponent(uri);

					var query = utils.KeyValueToUrl(Obj)

					// if (!uni.getStorageSync("singlePage")){
					//     uni.reLaunch({
					//         url:"/pages/home/home?"+uri 
					//     })
					// }
					uni.reLaunch({
						url: "/pages/home/home?" + query
					})
				} else {
					uni.redirectTo({
						url: "/pages/home/home"
					})
				}
			}
		}

		this.setShowShareMenuMixins();
		this.contentIdMixins = options.id || '';
		this.parentLogIdMixins = options.logId || '';
		this.currentLogIdMixins = '';
		this.sharePathMixins = '';

		// that.userLogMixins(0)
	},
	onUnload() {
		// this.userLogMixins(1)
		// console.log('mixins onUnload:', getCurrentPages(), )
	},
	methods: {
		...mapMutations(['setUserInfo', 'setLoginStatus', 'setUserId', "setShopInfo"]),
		async onShare(obj, callback) {
			console.log("mixins onShare", obj);

			let that = this;
			if (this.getIsProjectMixins()) {
				this.shareMiniProgram(this.multiProjectShareText, "", this.multiProjectShareImage)
			}

			if (obj && obj.id) {
				that.contentIdMixins = obj.id;
			}
			//===获取分享logId
			var logId = await that.getShareLogIdMixins()

			var path = '/pages/home/home?projectId=' + uni.getStorageSync("projectId")
			var logIdPath = '&logId=' + logId
			var shareUri = "&sharePath="
			var uri = '';
			var title = that.shopInfo.shareInfo;
			var imageUrl = that.shopInfo.shareImage;

			//===设置分享title
			if (that.shareTitleMixins && that.shareTitleMixins.length) {
				title = that.shareTitleMixins
			}
			//===设置分享image
			if (that.shareImageMixins && that.shareImageMixins.length) {
				imageUrl = that.shareImageMixins
			}

			if (obj&&obj.title&&obj.title.length > 0) {
				title = obj.title
			}

			if (obj&&obj.imageUrl&&obj.imageUrl.length > 0) {
				imageUrl = obj.imageUrl
			}

			if (that.sharePathParamMixin && that.sharePathParamMixin.length > 0) {
				uri = that.sharePathParamMixin;
			}else  if (obj&&obj.sharePath&&obj.sharePath.length>0) {
				uri = obj.sharePath;
			}else {
				let routes = getCurrentPages();
				let curRoute = routes[routes.length - 1].route
				if (sharePathMap[curRoute]) {
					uri = '/' + sharePathMap[curRoute] + '?id=' + that.contentIdMixins
				} else {
					uri = '/' + curRoute + '?id=' + that.contentIdMixins
				}
			}
			
			if (uri.indexOf('?') == -1) {
				uri += '?logId=' + logId
			} else {
				uri += '&logId=' + logId
			}

			shareUri += encodeURIComponent(uri)
			that.sharePathMixins = path + logIdPath + shareUri

			console.log('onShare:', obj, title, imageUrl, that.sharePathMixins)

			this.shareMiniProgram(title, that.sharePathMixins, imageUrl, callback)

		},

		shareMiniProgram(title, path, imageUrl, callback) {
			console.log('shareMiniProgram:', title, path, imageUrl)
			// #ifdef APP-PLUS		
			uni.share({
				provider: 'weixin',
				scene: "WXSceneSession",
				type: 5,
				imageUrl: imageUrl+'?x-image-process=image/resize,w_500,limit_1', //"https://etalk.obs.cn-south-1.myhuaweicloud.com:443/1642139096224661506.jpg",//,
				title: title,
				miniProgram: {
					id: this.shopInfo.wechatAppOriginId,//"gh_f9c917ce515d", //'gh_f9c917ce515d' gh_226042d35590,
					path: path,
					type: 0,
					webUrl: 'http://uniapp.dcloud.io'
				},
				success: ret => {
					console.log("shareMiniProgram", JSON.stringify(ret));
					(typeof callback=='function')&&callback({path:path})
				},
				fail: err => {
					console.log("shareMiniProgram err", JSON.stringify(err), err);
				}
			});
			// #endif
		},
		getIsProjectMixins() {
			let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
			let curRoute = routes[routes.length - 1].route //获取当前页面路由
			if ('pages/home/projects' == curRoute) {
				return true
			}
			return false
		},

		getHasRedpacket(callback) {

		},

		getLocation() {
			let that = this
			console.log("getLocation.start:")
			// uni.showToast({
			// 	icon:"none",
			// 	title:"需授权位置后，才能抢红包！"
			// })
			uni.getLocation({
				success: (res1) => {
					console.log("getLocation:", res1)
					api.authLocation({
						param: {
							lat: res1.latitude,
							lng: res1.longitude
						}
					}).then(res => {
						console.log(res)
						if (res.success) {
							that.getRedPacket()
						} else {

						}
					})
				}, // 成功的回调
				fail: (err) => {
					that.openSettingMixins()
					console.log("getLocation.fail", err)
				} // 失败的回调
			})
		},
		openSettingMixins() {
			let that = this
			uni.showModal({
				content: '检测到您“不允许”位置消息，是否去设置？',
				confirmText: "确认",
				cancelText: "取消",
				success: function(res) {
					if (res.confirm) {
						uni.openSetting({
							success(res) {
								if (res.authSetting['scope.userLocation']) {
									that.getRedPacket()
								} else {
									uni.showToast({
										title: '您不允许位置消息，无法参与活动！',
										icon: 'none'
									})
								}
							}
						})
					} else {
						uni.showToast({
							title: '您不允许位置消息，无法参与活动！',
							icon: 'none'
						})
					}
				}
			});
		},



		getRedPacket() {
			let that = this;
			let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
			let curRoute = routes[routes.length - 1].route //获取当前页面路由
			if (that.hasLogin) {
				for (var key in redpacketPathMap) {
					if (key == curRoute) {
						api.getRedpacketConfig({
							param: {
								showType: redpacketPathMap[key],
							}
						}).then(res => {
							console.log('getRedPacket', res)
							if (res.data) {
								that.isShowIntroMixin = true
								that.redPacketRuleIntroMixin = res.data.intro
								that.shareTitleMixins = res.data.shareInfo || '',
								that.shareImageMixins = res.data.shareImage || ''
								clearTimeout(redpacketTimerId);
								if (res.data.delayTime && res.data.delayTime > 0) {
									redpacketTimerId = setTimeout(() => {
										that.isShowIntroMixin = true
									}, res.data.delayTime * 1000)
								} else {
									that.isShowIntroMixin = true
								}
							}
							if (res.success) {
								that.isShowRedPacketMixin = true
							}
						})
					}
				}
			}
		},


		//===设置分享朋友圈
		setShowShareMenuMixins() {
			// #ifdef MP-WEIXIN||MP-TOUTIAO
			let that = this
			let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
			let curRoute = routes[routes.length - 1].route //获取当前页面路由
			let isSetFlag = false;
			for (var key in shareMenuList) {
				if (key == curRoute) {
					isSetFlag = true

					uni.showShareMenu({
						withShareTicket: true,
						menus: ['shareAppMessage', 'shareTimeline']
					})
				}
			}
			if (!isSetFlag) {

			}
			// #endif
		},

		async getShareLogIdMixins() {
			let that = this
			let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
			let curRoute = routes[routes.length - 1].route //获取当前页面路由
			console.log('getShareLogIdMixins:')

			// if (curRoute==)
			if (that.hasLogin) {
				for (var key in routeList) {
					if (key == curRoute) {
						console.log('mixins:', routeList[key])
						var res = await api.createUserLog({
							param: {
								actType: 'share',
								contentType: that.hasRedpacketActivityMixin ? 'activity' : routeList[key],
								contentId: that.contentIdMixins,
								parentId: '',
							}
						})
						console.log(res)
						if (res.success) {
							console.log("shareUserLogMixins:", res.data)
							return res.data
						} else {
							return ''
						}

					}
				}
			}
			return ''
		},
		userLogMixins(type) {
			let that = this
			let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
			let curRoute = routes[routes.length - 1].route //获取当前页面路由
			// if (curRoute==)
			if (that.hasLogin) {
				for (var key in routeList) {
					if (key == curRoute) {
						const contentType = that.hasRedpacketActivityMixin ? 'activity' : routeList[key]
						console.log('mixins:', routeList[key], that.hasRedpacketActivityMixin, contentType)
						if (type == 0) {
							api.createUserLog({
								param: {
									actType: 'view',
									contentType: contentType,
									contentId: that.contentIdMixins,
									parentId: that.parentLogIdMixins,
								}
							}).then(res => {
								console.log(res)
								if (res.success) {
									that.currentLogIdMixins = res.data
								}
							})
						} else if (type == 1) {
							api.updateUserLog({
								interfaceName: that.currentLogIdMixins,
								param: {

								}
							}).then(res => {
								console.log('updateUserLog', res)
								if (res.success) {
									// that.shareParentMixins = res.data
								}
							})
						} else if (type == 2) {
							api.createUserLog({
								param: {
									actType: 'share',
									contentType: contentType,
									contentId: that.contentIdMixins,
									parentId: '',
								}
							}).then(res => {
								console.log(res)
								if (res.success) {
									// that.currentLogIdMixins = res.data                                                                                                                   
								}
							})
						}
					}
				}
			}
		},





		test() {
			var vn = null
			var gn = [{
				name: "scanCode"
			}, {
				name: "chooseAddress"
			}, {
				name: "chooseImage"
			}, {
				name: "previewImage"
			}, {
				name: "chooseInvoiceTitle"
			}, {
				name: "chooseInvoice"
			}]

			gn.forEach(function(n) {
				n.fn = wx[n.name];
				var t = n.name;
				try {
					Object.defineProperty(wx, t, {
						get: function() {
							console.log(n.name)
							return vn = !0, n.fn
						}
					})
				} catch (n) {}
			})
		},



		//转义符换成普通字符
		escape2Html(str) {
			if (!str) return str;
			var arrEntities = {
				'lt': '<',
				'gt': '>',
				'nbsp': ' ',
				'amp': '&',
				'quot': '"'
			};
			return str.replace(/&(lt|gt|nbsp|amp|quot);/ig, function(all, t) {
				return arrEntities[t];
			});
		},
		//普通字符转换成转义符
		html2Escape(sHtml) {
			if (!sHtml) return sHtml;
			return sHtml.replace(/[<>&"]/g, function(c) {
				return {
					'<': '&lt;',
					'>': '&gt;',
					'&': '&amp;',
					'"': '&quot;'
				} [c];
			});
		},
		//setData polyfill 勿删!!!   (用于转换后的uniapp的项目能直接使用this.setData()函数)
		setData: function(obj, callback) {
			let that = this;
			const handleData = (tepData, tepKey, afterKey) => {
				var tepData2 = tepData;
				tepKey = tepKey.split('.');
				tepKey.forEach(item => {
					if (tepData[item] === null || tepData[item] === undefined) {
						let reg = /^[0-9]+$/;
						tepData[item] = reg.test(afterKey) ? [] : {};
						tepData2 = tepData[item];
					} else {
						tepData2 = tepData[item];
					}
				});
				return tepData2;
			};
			const isFn = function(value) {
				return typeof value == 'function' || false;
			};
			Object.keys(obj).forEach(function(key) {
				let val = obj[key];
				key = key.replace(/\]/g, '').replace(/\[/g, '.');
				let front, after;
				let index_after = key.lastIndexOf('.');
				if (index_after != -1) {
					after = key.slice(index_after + 1);
					front = handleData(that, key.slice(0, index_after), after);
				} else {
					after = key;
					front = that;
				}
				if (front.$data && front.$data[after] === undefined) {
					Object.defineProperty(front, after, {
						get() {
							return front.$data[after];
						},
						set(newValue) {
							front.$data[after] = newValue;
							that.hasOwnProperty("$forceUpdate") && that.$forceUpdate();
						},
						enumerable: true,
						configurable: true
					});
					front[after] = val;
				} else {
					that.$set(front, after, val);
				}
			});
			// this.$forceUpdate();
			isFn(callback) && this.$nextTick(callback);
		}
	}
}